package com.company.OfferGuide;

import java.util.Arrays;

public class 旋转数组的最小数字 {

    public int minArray01(int[] numbers) {
        Arrays.sort(numbers);
        return numbers[0];
    }

    public int minArray(int[] numbers) {
        int low =0,high = numbers.length - 1;
        while (low < high) {
            int mid = (high + low) / 2;
            if (numbers[mid] > numbers[high] ) low = mid + 1;
            else if (numbers[mid] < numbers[high]) high = mid;
            else {
                high--;
            }
        }
        return numbers[low];
    }

}
